namespace SimpleWebServices
{
    using System.Globalization;
    using System.Reflection;

    public sealed class PropertyGetterTest<T> : ITestExpectation
    {
        public PropertyGetterTest(PropertyInfo property)
        {
            this.Property = property;
        }

        public PropertyInfo Property
        {
            get;
            set;
        }

        public object Expected
        {
            get;
            set;
        }

        public bool Check()
        {
            if (!object.Equals(
                typeof(T),
                this.Property.PropertyType))
            {
                throw new TestException(string.Format(CultureInfo.InvariantCulture, "{0}.{1} did not equal the expected value.", this.Property.PropertyType, typeof(T)));
            }

            return true;
        }
    }
}